home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20000114-20000217 / 000108_news@columbia.edu _Fri Jan 21 13:26:44 2000.msg < prev    next >
Internet Message Format  |  2020-01-01  |  5KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id NAA26675
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Fri, 21 Jan 2000 13:26:44 -0500 (EST)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id NAA24730
  7.     for kermit.misc@watsun.cc.columbia.edu; Fri, 21 Jan 2000 13:09:02 -0500 (EST)
  8. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Subject: Case Study #13: PPP Dialing
  11. Date: 21 Jan 2000 18:09:01 GMT
  12. Organization: Columbia University
  13. Message-ID: <86a7bt$o4o$1@newsmaster.cc.columbia.edu>
  14. To: kermit.misc@columbia.edu
  15.  
  16.  
  17.   Reminder: These case studies and tutorials are also available 
  18.   on the C-Kermit web page:
  19.  
  20.     http://www.columbia.edu/kermit/ckermit.html#studies
  21.  
  22.   You might prefer to read them there, where you can follow
  23.   links conveniently.
  24.  
  25. For years, people have been asking us how to use C-Kermit as their PPP
  26. dialer in Linux and other kinds of Unix.  Until now, there has never been
  27. a good answer.  There were some half-good answers, such as those found in
  28. item 27 of the Kermit FAQ.  The problem was that any connection opened by
  29. C-Kermit would be closed when it exited, so C-Kermit had to be kept alive
  30. (even though it wasn't doing anything) for the duration of the PPP
  31. connection.
  32.  
  33. C-Kermit 7.0 includes a new command that handles PPP dialing in a natural
  34. and straightforward way:
  35.  
  36. EXEC [ /REDIRECT ] <command> [ <arg1> [ <arg2> [ ... ] ]
  37.   Runs the given command with the arguments in such a way that the
  38.   <command> replaces C-Kermit in memory, and C-Kermit ceases to execute.
  39.   EXEC is like RUN, except instead of returning to C-Kermit when finished,
  40.   the <command> returns to whatever process invoked Kermit.
  41.  
  42. In the normal case, no files are closed, so the EXEC'd command inherits
  43. the open files, read/write pointers, working directory, process ID, user
  44. ID (unless <command> is SUID), group ID (unless command is SGID), groups,
  45. etc; in UNIX, the EXEC command is simply a front end for the execvp()
  46. system service.
  47.  
  48. If the /REDIRECT switch is included, then if a connection is open (SET
  49. LINE or SET HOST), it becomes the standard input and output of the EXEC'd
  50. program.  This is how PPP dialing is done.
  51.  
  52. Here's an example for Linux, in which we dial a traditional terminal
  53. server that issues a login and password prompt (as opposed to, say, using
  54. PAP or CHAP authentication).  We assume that the script has already set up
  55. the myuserid and mypassword variables (normally the password should be
  56. prompted for, not stored on disk).
  57.  
  58.   set modem type usr          ; Specify the kind of modem you have
  59.   set line /dev/ttyS1         ; Specify the device it's connected to
  60.   set speed 57600             ; and the speed
  61.   set flow rts/cts            ; and flow control.
  62.   set dial retries 100        ; Try the dial sequence up to 100 times.
  63.   dial {{+1(212)555-1212}{+1(212)555-1213}{+1(212)9-555-1214}}
  64.   if fail exit 1
  65.   for \%i 1 16 1 {            ; Try up to 16 times to get login prompt
  66.       input 10 Login:         ; Wait 10 sec for it to appear
  67.       if success break        ; Got it - proceed...
  68.       output \13              ; Send a carriage return and try again
  69.   }
  70.   if ( > \%i 16 ) exit 1 NO LOGIN PROMPT
  71.   lineout \(myuserid)         ; Send user ID
  72.   input 30 assword:           ; Wait for Password prompt
  73.   if fail stop 1 NO PASSWORD PROMPT
  74.   lineout \m(mypassword)      ; Send the password.
  75.   exec /redirect pppd         ; Replace ourselves with pppd.
  76.  
  77. Just before the "exec" command, you might also need to send a command
  78. to the terminal server that tells it to start PPP; some terminal servers
  79. always start PPP, some give you a choice of Telnet, Rlogin, PPP, SLIP,
  80. LAT, and/or other services.
  81.  
  82. Notice the advantages over the well-known "chat script":
  83.  
  84.  . You don't have to control the modem itself with AT commands; Kermit's
  85.    DIAL command does this for you.
  86.  
  87.  . You can have Kermit automatically redial automatically as many times
  88.    as you want until it gets a connection (if that is legal in your
  89.    country); in this example, three numbers are dialed up to 100 times
  90.    each.
  91.  
  92.  . You can have Kermit fetch the number or numbers from a dialing
  93.    directory.
  94.  
  95.  . You can have Kermit cycle through a list of phone numbers without
  96.    having to enter the numbers in a dialing directory, as shown above.
  97.  
  98.  . Dialing is location-independent; you can use the same script to dial
  99.    from different areas or countries.
  100.  
  101.  . Once the connection is made, the full power of Kermit's script
  102.    language is available to manage the dialog with the terminal server
  103.    or other device that answers the phone call.
  104.  
  105. The syntax of the DIAL command in the example is new to C-Kermit 7.0 and
  106. explained in Section 2.1.15 of the ckermit2.txt file; it lets you give a
  107. list of numbers to be dialed in case the first one doesn't answer; as
  108. noted, the only way to do this in earlier C-Kermit versions was with a
  109. dialing directory.
  110.  
  111. The sample script is not universal, but not that hard to generalize by
  112. making it a Kerbang script (called, say, "startppp") that takes phone
  113. numbers, username, and password as command-line arguments and prompts
  114. interactively for any of these that are missing.
  115.  
  116. - Frank